$(document).ready(function () {
    arrayByTeacher();
})

function arrayByTeacher() {
    var user = localStorage.getItem(schoolLoginUserInfo);
    if (user == null) {
        toLogin();
    }
    var res = eval('(' + user + ')');
    var data = "tId=" + res.id;
    $.ajax({
        "url": url + scoreByParamUrl,
        "type": 'get',
        "data": data,
        "dataType": "json",
        "success": function (data) {
            var res = eval('(' + JSON.stringify(data) + ')');
            if (res.resultCode != 200) {
                error(data);
                return;
            }
            appand(data.obj);
        },
        "error": error()
    })

}


function appand(data) {
    // alert(1)
    // var page = eval('(' + data + ')');
    var array = data;
    if(data.length==0){
        alert("暂无评论")
    }
    var table = "<tr>\n" +
        "                        <th>评论时间</th>\n" +
        "                        <th>评分</th>\n" +
        "                        <th>评论</th>\n" +
        "                    </tr>";
    for (var i = 0; i < array.length; i++) {
        table += "<tr>\n" +
            "                        <td>" + timestampToTime(array[i].createTime) + "</td>\n" +
            "                        <td>" + array[i].score + "</td>\n"+
            "                        <td>" + array[i].content + "</td>\n";
    }
    table += "                    </tr>";
    $("#userTable").empty()
    $("#userTable").append(table);
}






